import { useDescriptionsType } from '@/components/DescriptionsType';
import { useContext, useState } from 'react';
import { ConractControllerContext } from '../common';
import { SearchOutlined, EyeOutlined } from '@ant-design/icons';
import { TagSelectNew } from '@/components/TagSelectNew';
import { Checkbox, Form, Space, message } from 'antd';
import {
  getCompanyID,
  getFileNameByPath,
  getLoadMapList,
  getPersonalInfo,
  getPosIDs,
  getTenantID,
  getUserDepID,
  getUserDepName,
  getUserID,
  getUserName,
  renderTableTextNotColor,
} from '@/utils';
import { ILoadMapTypeAll } from '@/common';
import { UpdatePaymentView } from '../mview/UpdatePaymentView';
import { RegularExpression } from '@/common/constVariable';
import { UpdateCounterpartView } from '../mview/UpdateCounterpartView';
import { UpdateMaterialTableView } from '../mview/UpdateMaterialTableView';
import { defaultDetailList, defaultPayList, changePayList } from './useMyUtil';
import { UploadFormCommon } from '@/components/UploadForm';
import { UpdateFirstPartyTableView } from '../mview/UpdateFirstPartyTableView';

interface IGetModifyUpdateDes {
  openOldContractInfo: () => void;
  changeModifyItem: Record<string, any>;
  setChangeModifyItem: (obj: Record<string, any>) => void;
  setOpenSujbectModal: (bool: boolean) => void;
  openCounterpartModal: (open: boolean) => void;
  onNtkoReadWord: (url: string, urlObj: Record<string, any>, onlyRead?: boolean) => void;
  onOpenReadOfdWord: (url: string) => void;
  isSeeOldContract?: boolean;
  setOpenMaterialModal: (bool: boolean) => void;
}
const getModifyUpdateDes = ({
  openOldContractInfo,
  changeModifyItem,
  setChangeModifyItem,
  setOpenSujbectModal,
  openCounterpartModal,
  onNtkoReadWord,
  onOpenReadOfdWord,
  isSeeOldContract,
  setOpenMaterialModal,
}: IGetModifyUpdateDes) => {
  /** 获取上下文 */
  const { pageType, contractForm, oldContractInfo, contractDetailInfo, contractDispatch, contarctJsonList } = useContext(ConractControllerContext);

  /**  获取数据字典 */
  const { loadMapInfo, mapLoading } = getLoadMapList([
    `${getTenantID()}${ILoadMapTypeAll.PAYMENT_STYLE}`, //支付方式
    `${getTenantID()}${ILoadMapTypeAll.COMPANY_TAXRATE}`, //税率
    `${getTenantID()}${ILoadMapTypeAll.CONTRACT_FIELDTYPE}`, //合同附件类型
    `${getTenantID()}${ILoadMapTypeAll.MATERIAL_MIDI}`, //量化单位
    `${getTenantID()}${ILoadMapTypeAll.CONTRACT_TYPE}`, // 合同类型
    `${getTenantID()}${ILoadMapTypeAll.CONTRACT_STATE}`, // 合同状态
    `${getTenantID()}${ILoadMapTypeAll.PURCHASE_CATEGORY}`, //供货类别
    `${getTenantID()}${ILoadMapTypeAll.MATERIAL_MIDI}`, //量化单位
    // `${getTenantID()}${ILoadMapTypeAll.MATERIAL_BRAND}`, //品牌
    `${getTenantID()}${ILoadMapTypeAll.CONTRACT_CURRENCYTYPE}`, //币种
  ]);
  /** 保存币种类型 */
  const [currencyType, setCurrencyType] = useState<any>();

  const getShortCode = (id, contractForm) => {
    let shortCode = '';
    const setShortCode = (children) => {
      (children || []).forEach((item) => {
        if (item?.id == id) {
          shortCode = item.shortCode;
        } else {
          if (item.children && item.children?.length) setShortCode(item.children);
        }
      });
    };
    setShortCode(loadMapInfo?.[`${getTenantID()}${ILoadMapTypeAll.CONTRACT_TYPE}`]);
    contractForm?.setFieldsValue({
      contractTypeCode: shortCode,
    });

    return shortCode;
  };

  const payMentCode: string = `${getTenantID()}${ILoadMapTypeAll.PAYMENT_STYLE}`; //支付方式字典编码
  const payMentTypeList: Record<string, any>[] = loadMapInfo?.[payMentCode]?.filter((item: any) => item?.id != `${payMentCode}1002`);

  /** 保存预计开始时间 */
  const [preBeginTimeStart, setPreBeginTimeStart] = useState<any>();

  /** 保存支付方式 */
  const [paymentType, setPaymentType] = useState<string>(oldContractInfo?.payStyle || '');

  let configShemas: any = [
    {
      key: 'contract-old-modify',
      title: '变更信息',
      fieldChildren: [
        {
          field: `contractName`,
          label: `变更合同名称`,
          component: 'Input',
          placeholder: '请输入变更合同名称',
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
          // colSpan: 2,
        },
        {
          field: `contractCode`,
          label: `变更合同编号`,
          component: 'Input',
          placeholder: '自动带出',
          disabled: true,
        },
        {
          field: 'contractTypeCode',
          label: '合同类型编码',
          component: 'Input',
          placeholder: '请输入',
          disabled: true,
          colSpan: 2,
          initialValue: getShortCode(contractDetailInfo?.businessType, contractForm),
          display: 'none',
        },
        {
          field: `oldContractName`,
          label: `原合同名称`,
          component: 'Input',
          placeholder: '请输入原合同名称',
          disabled: true,
          contentAfter: isSeeOldContract ? (
            <a onClick={openOldContractInfo}>
              <EyeOutlined />
            </a>
          ) : pageType == 'detail' ? null : (
            <a onClick={openOldContractInfo}>
              <EyeOutlined />
            </a>
          ),
        },
        {
          field: `oldContractCode`,
          label: `原合同编号`,
          component: 'Input',
          disabled: true,
          placeholder: '自动生成',
        },
        {
          field: `beyondFlag`,
          label: `是否超原合同采购金额10%`,
          component: 'Render',
          slotRender: (text) => {
            if (pageType == 'detail') {
              return (
                <Form.Item name="beyondFlag" style={{ cursor: 'not-allowed' }}>
                  {renderTableTextNotColor(text)}
                </Form.Item>
              );
            } else {
              return (
                <TagSelectNew
                  formLabel=""
                  formName="beyondFlag"
                  radioDisabled={true}
                  radioList={[
                    {
                      value: 1,
                      name: '是',
                      disabled: true,
                    },
                    {
                      value: 0,
                      name: '否',
                      disabled: true,
                    },
                  ]}
                  defalultKeys={text || 0}
                />
              );
            }
          },
        },
        {
          field: `contractURL`,
          label: `变更合同文本`,
          component: 'Render',
          required: pageType == 'detail' ? false : true,
          slotRender: (text: any) => {
            if (pageType == 'detail') {
              const contractName = text ? getFileNameByPath(text) : '';
              return (
                <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between', padding: 10 }}>
                  {contractName ? (
                    <>
                      <a>{contractName}</a>
                      <a
                        onClick={() => {
                          // onNtkoReadWord('contractURL', contractDetailInfo, pageType == 'detail' ? true : false);
                          onOpenReadOfdWord(contractDetailInfo?.contractURL);
                        }}
                      >
                        <EyeOutlined />
                      </a>
                    </>
                  ) : (
                    <span>--</span>
                  )}
                </div>
              );
            } else {
              return (
                <UploadFormCommon
                  form={config.form}
                  label=""
                  fileFormName={'contractURL'}
                  spanCol={24}
                  inRowProportion={24}
                  name={'attachFile'}
                  required={true}
                  accept={'.docx|.doc'}
                  url={'/contractController/uploadFile'}
                  downloadUrl={'/contractController/downloadFile'}
                  fileFormDelName={'contractURLDel'}
                  delFunc={() => {}}
                  maxFile={1}
                  defaultFiles={contractDetailInfo && contractDetailInfo?.id ? contractDetailInfo?.contractURL : null}
                  isEdit={true}
                  fieldBusiPath={'contract/info'}
                  onNtkoRead={(wordUrl: string) => {
                    // onNtkoReadWord('contractURL', contractForm?.getFieldsValue(), pageType == 'detail' ? true : false);
                    // console.log('contractURL',contractForm?.getFieldValue('contractURL'))
                    // console.log('onOpenReadOfdWord',onOpenReadOfdWord)
                    onOpenReadOfdWord(contractForm?.getFieldValue('contractURL'));
                  }}
                >
                  上传合同文本
                </UploadFormCommon>
              );
            }
          },
        },
        {
          field: `changeContent`,
          label: `变更内容及原因`,
          component: 'InputTextArea',
          placeholder: '请输入变更内容及原因',
          colSpan: 2,
          allowClear: true,
          showCount: true,
          maxLength: 800,
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
          autoSize: { minRows: 5, maxRows: 8 },
        },
        {
          field: 'chanageItem',
          label: '变更事项',
          component: 'Render',
          colSpan: 2,
          required: pageType == 'detail' ? false : true,
          slotRender: () => {
            return (
              <Space wrap size={[0, 8]}>
                <Form.Item name="changeSum" initialValue={0}>
                  <Checkbox
                    disabled={pageType == 'detail' ? true : false}
                    checked={changeModifyItem?.changeSum == 1}
                    onChange={(e: any) => {
                      setChangeModifyItem({
                        ...changeModifyItem,
                        changeSum: e?.target?.checked ? 1 : 0,
                        changePay: e?.target?.checked ? 1 : 0,
                      });
                      contractForm?.setFieldsValue({
                        changeSum: e?.target?.checked ? 1 : 0,
                        changePay: e?.target?.checked ? 1 : 0,
                      });
                      defaultPayList(e?.target?.checked ? oldContractInfo?.processList : [], contractForm, contractDispatch, contarctJsonList);
                    }}
                    style={{ whiteSpace: 'nowrap' }}
                  >
                    合同金额
                  </Checkbox>
                </Form.Item>
                <Form.Item name="changeTerm" initialValue={0}>
                  <Checkbox
                    disabled={pageType == 'detail' ? true : false}
                    checked={changeModifyItem?.changeTerm == 1}
                    onChange={(e: any) => {
                      setChangeModifyItem({
                        ...changeModifyItem,
                        changeTerm: e?.target?.checked ? 1 : 0,
                      });
                      contractForm?.setFieldsValue({
                        changeTerm: e?.target?.checked ? 1 : 0,
                      });
                    }}
                    style={{ whiteSpace: 'nowrap' }}
                  >
                    履约期限
                  </Checkbox>
                </Form.Item>
                <Form.Item name="changeSubject" initialValue={0}>
                  <Checkbox
                    disabled={pageType == 'detail' ? true : false}
                    checked={changeModifyItem?.changeSubject == 1}
                    onChange={(e: any) => {
                      setChangeModifyItem({
                        ...changeModifyItem,
                        changeSubject: e?.target?.checked ? 1 : 0,
                      });
                      contractForm?.setFieldsValue({
                        changeSubject: e?.target?.checked ? 1 : 0,
                      });
                    }}
                    style={{ whiteSpace: 'nowrap' }}
                  >
                    合同主体
                  </Checkbox>
                </Form.Item>
                <Form.Item name="changeOpposite" initialValue={0}>
                  <Checkbox
                    disabled={pageType == 'detail' ? true : false}
                    checked={changeModifyItem?.changeOpposite == 1}
                    onChange={(e: any) => {
                      setChangeModifyItem({
                        ...changeModifyItem,
                        changeOpposite: e?.target?.checked ? 1 : 0,
                      });
                      contractForm?.setFieldsValue({
                        changeOpposite: e?.target?.checked ? 1 : 0,
                      });
                    }}
                    style={{ whiteSpace: 'nowrap' }}
                  >
                    相对方信息
                  </Checkbox>
                </Form.Item>
                <Form.Item name="changePay" initialValue={0}>
                  <Checkbox
                    disabled={pageType == 'detail' ? true : false}
                    checked={changeModifyItem?.changePay == 1}
                    onChange={(e: any) => {
                      setChangeModifyItem({
                        ...changeModifyItem,
                        changePay: e?.target?.checked ? 1 : 0,
                        changeSum: e?.target?.checked ? 1 : 0,
                      });
                      contractForm?.setFieldsValue({
                        changePay: e?.target?.checked ? 1 : 0,
                        changeSum: e?.target?.checked ? 1 : 0,
                      });
                      defaultPayList(e?.target?.checked ? oldContractInfo?.processList : [], contractForm, contractDispatch, contarctJsonList);
                    }}
                    style={{ whiteSpace: 'nowrap' }}
                  >
                    履约关键节点
                  </Checkbox>
                </Form.Item>
                <Form.Item name="changeDetail" initialValue={0}>
                  <Checkbox
                    disabled={pageType == 'detail' ? true : false}
                    checked={changeModifyItem?.changeDetail == 1}
                    onChange={(e: any) => {
                      setChangeModifyItem({
                        ...changeModifyItem,
                        changeDetail: e?.target?.checked ? 1 : 0,
                      });
                      contractForm?.setFieldsValue({
                        changeDetail: e?.target?.checked ? 1 : 0,
                      });
                      defaultDetailList(e?.target?.checked ? oldContractInfo?.detailList : [], contractForm, contractDispatch, contarctJsonList);
                    }}
                    style={{ whiteSpace: 'nowrap' }}
                  >
                    货物/服务清单
                  </Checkbox>
                </Form.Item>
                <Form.Item name="changeOther" initialValue={0}>
                  <Checkbox
                    disabled={pageType == 'detail' ? true : false}
                    checked={changeModifyItem?.changeOther == 1}
                    onChange={(e: any) => {
                      setChangeModifyItem({
                        ...changeModifyItem,
                        changeOther: e?.target?.checked ? 1 : 0,
                      });
                      contractForm?.setFieldsValue({
                        changeOther: e?.target?.checked ? 1 : 0,
                      });
                    }}
                    style={{ whiteSpace: 'nowrap' }}
                  >
                    其他
                  </Checkbox>
                </Form.Item>
              </Space>
            );
          },
        },
        {
          field: `oldCurrencyType`,
          label: `原币种`,
          component: 'Select',
          placeholder: '原币种',
          disabled: true,
          showArrow: false,
          ishidden: !(changeModifyItem?.changeSum == 1),
          options: loadMapInfo?.[`${getTenantID()}${ILoadMapTypeAll.CONTRACT_CURRENCYTYPE}`],
          fieldNames: {
            label: 'name',
            value: 'id',
          },
        },
        {
          field: `currencyType`,
          label: `变更币种`,
          component: 'Select',
          placeholder: '请选择',
          ishidden: !(changeModifyItem?.changeSum == 1),
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
          showArrow: pageType == 'detail' ? false : true,
          options: loadMapInfo?.[`${getTenantID()}${ILoadMapTypeAll.CONTRACT_CURRENCYTYPE}`],
          initialValue: `${getTenantID()}${ILoadMapTypeAll.CONTRACT_CURRENCYTYPE}1000`,
          onChange: (value: string) => {
            if (value == `${getTenantID()}${ILoadMapTypeAll.CONTRACT_CURRENCYTYPE}1000`) {
              contractForm?.setFieldsValue({
                currencyRate: 1,
              });
            }
            setCurrencyType(value);
          },
          fieldNames: {
            label: 'name',
            value: 'id',
          },
        },
        {
          field: `oldCurrencyRate`,
          label: `原汇率`,
          placeholder: '原汇率',
          component: 'InputNumber',
          disabled: true,
          ishidden: !(changeModifyItem?.changeSum == 1),
          step: '0.0001',
        },
        {
          field: `currencyRate`,
          label: `变更汇率`,
          component: 'InputNumber',
          placeholder: '请输入',
          ishidden: !(changeModifyItem?.changeSum == 1),
          required: pageType == 'detail' ? false : true,
          disabled:
            pageType == 'detail' || contractForm?.getFieldValue('currencyType') == `${getTenantID()}${ILoadMapTypeAll.CONTRACT_CURRENCYTYPE}1000`
              ? true
              : false,
          pattern: RegularExpression?.currencyRate,
          patternMsg: '请输入正确汇率',
          step: '0.0001',
        },
        {
          field: `oldSumInTax`,
          label: `原合同金额`,
          component: 'InputNumber',
          placeholder: '原合同金额',
          ishidden: !(changeModifyItem?.changeSum == 1),
          disabled: true,
          min: 0,
          initialValue: 0.0,
          contentAfter: '元',
          step: '0.0001',
        },
        {
          field: `sumInTax`,
          label: `变更合同金额`,
          component: 'InputNumber',
          placeholder: '变更合同金额',
          ishidden: !(changeModifyItem?.changeSum == 1),
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
          min: 0,
          initialValue: 0.0,
          contentAfter: '元',
          step: '0.0001',
          pattern: RegularExpression?.two2FloatNumber,
          patternMsg: '合同金额，最多四位小数',
          onChange: (e) => {
            changePayList(contractForm, contractDispatch, contarctJsonList, `${getTenantID()}${ILoadMapTypeAll.PAYMENT_STYLE}`);
          },
        },
        {
          field: `oldPreBeginTime`,
          label: `原预计起始时间`,
          component: 'DatePicker',
          format: 'YYYY-MM-DD',
          placeholder: pageType == 'detail' ? '--' : '请选择',
          disabled: true,
          ishidden: !(changeModifyItem?.changeTerm == 1),
        },
        {
          field: `oldPreFinishTime`,
          label: `原预计结束时间`,
          component: 'DatePicker',
          format: 'YYYY-MM-DD',
          placeholder: pageType == 'detail' ? '--' : '请选择',
          disabled: true,
          ishidden: !(changeModifyItem?.changeTerm == 1),
        },
        {
          field: `preBeginTime`,
          label: `变更预计起始时间`,
          component: 'DatePicker',
          format: 'YYYY-MM-DD',
          placeholder: '请选择',
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
          ishidden: !(changeModifyItem?.changeTerm == 1),
          onChange: (date: any) => {
            setPreBeginTimeStart(date);
          },
        },
        {
          field: `preFinishTime`,
          label: `变更预计结束时间`,
          component: 'DatePicker',
          format: 'YYYY-MM-DD',
          placeholder: '请选择',
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
          ishidden: !(changeModifyItem?.changeTerm == 1),
          disabledDate: (date: any) => {
            const currentDate: any = preBeginTimeStart ? preBeginTimeStart : date;
            return date && date < currentDate;
          },
        },
        {
          field: `oldPayStyle`,
          label: `原支付方式`,
          component: 'Select',
          placeholder: '请选择',
          disabled: true,
          showArrow: false,
          options: loadMapInfo?.[payMentCode],
          ishidden: !(changeModifyItem?.changePay == 1),
          fieldNames: {
            label: 'name',
            value: 'id',
          },
        },
        {
          field: `payStyle`,
          label: `变更支付方式`,
          component: 'Select',
          placeholder: '请选择',
          required: pageType == 'detail' ? false : changeModifyItem?.isPayDisabled ? false : true,
          disabled:
            pageType == 'detail'
              ? true
              : changeModifyItem?.isPayDisabled
              ? true
              : oldContractInfo?.payStyle == `${getTenantID()}${ILoadMapTypeAll.PAYMENT_STYLE}1002`
              ? true
              : false,
          showArrow: pageType == 'detail' ? false : changeModifyItem?.isPayDisabled ? false : true,
          options: oldContractInfo?.payStyle == `${getTenantID()}${ILoadMapTypeAll.PAYMENT_STYLE}1002` ? loadMapInfo?.[payMentCode] : payMentTypeList,
          ishidden: !(changeModifyItem?.changePay == 1),
          onChange: (value: string) => {
            const contractAllNum: number = contractForm?.getFieldValue('sumInTax') ? contractForm?.getFieldValue('sumInTax') : 0;
            if (contractAllNum > 0) {
              setPaymentType(value);
            } else {
              message.warning('请先输入合同金额！');
              contractForm?.setFieldsValue({
                payStyle: null,
              });
            }
          },
          fieldNames: {
            label: 'name',
            value: 'id',
          },
        },
        {
          field: `realBeginTime`,
          label: `合同签订时间`,
          component: 'DatePicker',
          format: 'YYYY-MM-DD',
          placeholder: '请选择',
          colSpan: 2,
          display: 'none',
        },
        {
          field: `realFinishTime`,
          label: `合同截止时间`,
          component: 'DatePicker',
          format: 'YYYY-MM-DD',
          placeholder: '请选择',
          colSpan: 2,
          display: 'none',
        },
        {
          field: `preBeginTime`,
          label: `预计起始时间`,
          component: 'DatePicker',
          format: 'YYYY-MM-DD',
          placeholder: '请选择',
          ishidden: !(changeModifyItem?.changeTerm != 1),
          colSpan: 2,
          display: 'none',
        },
        {
          field: `preFinishTime`,
          label: `预计结束时间`,
          component: 'DatePicker',
          format: 'YYYY-MM-DD',
          placeholder: '请选择',
          ishidden: !(changeModifyItem?.changeTerm != 1),
          colSpan: 2,
          display: 'none',
        },
        {
          field: `oppositeName`,
          label: `合同主体名称`,
          component: 'Input',
          // required: pageType == 'detail' ? false : true,
          disabled: true,
          message: '请选择合同主体名称',
          placeholder: '请选择',
          colSpan: 2,
          display: 'none',
        },
        {
          field: `ownDepartmentName`,
          label: `申请部门`,
          component: 'Input',
          disabled: true,
          placeholder: '自动带出',
          initialValue: getUserDepName(),
          colSpan: 2,
          display: 'none',
        },
        {
          field: `creditID`,
          label: `统一社会信用代码`,
          component: 'Input',
          disabled: true,
          placeholder: '自动带出',
          colSpan: 2,
          display: 'none',
        },
        {
          field: `bankName`,
          label: `开户行名称`,
          component: 'Input',
          disabled: true,
          placeholder: '自动带出',
          colSpan: 2,
          display: 'none',
        },
        {
          field: `bankAccount`,
          label: `开户行账号`,
          component: 'Input',
          disabled: true,
          placeholder: '自动带出',
          colSpan: 2,
          display: 'none',
        },
        {
          field: `workAddress`,
          label: `单位地址`,
          component: 'Input',
          disabled: true,
          placeholder: '自动带出',
          colSpan: 2,
          display: 'none',
        },
        {
          field: `registerPhone`,
          label: `单位电话`,
          component: 'Input',
          disabled: true,
          placeholder: '自动带出',
          colSpan: 2,
          display: 'none',
        },
        {
          field: `ownerName`,
          label: `联系人`,
          component: 'Input',
          placeholder: '请选择联系人',
          disabled: true,
          initialValue: getUserName(),
          colSpan: 2,
          display: 'none',
        },
        {
          field: `ownPhone`,
          label: `联系电话`,
          component: 'Input',
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
          placeholder: '请输入',
          // pattern: RegularExpression.phone,
          // patternMsg: '联系电话格式不正确',
          initialValue: getPersonalInfo()?.phoneMobile,
          colSpan: 2,
          display: 'none',
        },
        {
          field: `oppositeID`,
          label: `合同主体ID`,
          component: 'Input',
          message: '请选择合同主体ID',
          placeholder: '请选择',
          disabled: true,
          colSpan: 2,
          display: 'none',
        },
        {
          field: `contactName`,
          label: `联系人`,
          component: 'Input',
          message: '请选择联系人',
          placeholder: '请选择',
          disabled: true,
          colSpan: 2,
          display: 'none',
        },
        {
          field: `phoneMobile`,
          label: `联系人电话`,
          component: 'Input',
          message: '请选择联系人电话',
          placeholder: '请选择',
          disabled: true,
          colSpan: 2,
          display: 'none',
        },
        {
          field: `ownerID`,
          label: `联系人ID`,
          component: 'Input',
          message: '请选择联系人ID',
          placeholder: '请选择',
          disabled: true,
          initialValue: getUserID(),
          colSpan: 2,
          display: 'none',
        },
        {
          field: `ownCompanyID`,
          label: `联系人公司ID`,
          component: 'Input',
          message: '请选择联系人公司ID',
          placeholder: '请选择',
          disabled: true,
          initialValue: getCompanyID(),
          colSpan: 2,
          display: 'none',
        },
        {
          field: `ownDepartmentID`,
          label: `联系人部门ID`,
          component: 'Input',
          message: '请选择联系人部门ID',
          placeholder: '请选择',
          disabled: true,
          colSpan: 2,
          initialValue: getUserDepID(),
          display: 'none',
        },
        {
          field: `ownPositionID`,
          label: `联系人岗位ID`,
          component: 'Input',
          message: '请选择联系人岗位ID',
          placeholder: '请选择',
          disabled: true,
          initialValue: getPosIDs(),
          colSpan: 2,
          display: 'none',
        },

        // {
        //   field: `oldProjectName`,
        //   label: `原资金来源`,
        //   component: 'Input',
        //   disabled: true,
        //   placeholder: '自动生成',
        // },
        // {
        //   field: `oldProjectCode`,
        //   label: `原来源项目编号`,
        //   component: 'Input',
        //   disabled: true,
        //   placeholder: '自动生成',
        // },
        // {
        //   field: `oldContractInfo`,
        //   label: `原合同简介`,
        //   component: 'InputTextArea',
        //   placeholder: '请输入原合同简介',
        //   disabled: true,
        //   colSpan: 2,
        //   allowClear: true,
        //   showCount: true,
        //   maxLength: 500,
        //   required: false,
        //   autoSize: { minRows: 4, maxRows: 8 },
        // },
        // {
        //   field: `workflowType`,
        //   label: `合同流程`,
        //   component: 'Input',
        //   message: '合同流程',
        //   placeholder: '合同流程',
        //   initialValue: `${getTenantID()}${ILoadMapTypeAll.CONTRACT_FLOWTYPE}1000`,
        //   disabled: true,
        //   colSpan: 2,
        //   display: 'none',
        // },
      ],
    },
    // {
    //   key: 'contract-modify-change',
    //   title: '变更信息',
    //   fieldChildren: [
    //     {
    //       field: `contractName`,
    //       label: `变更合同名称`,
    //       component: 'Input',
    //       placeholder: '请输入变更合同名称',
    //       required: pageType == 'detail' ? false : true,
    //       disabled: pageType == 'detail' ? true : false,
    //       colSpan: 2,
    //     },
    //     {
    //       field: `contractCode`,
    //       label: `变更合同编号`,
    //       component: 'Input',
    //       placeholder: '请输入变更合同编号',
    //       disabled: true,
    //     },
    //     {
    //       field: `state`,
    //       label: `合同状态`,
    //       component: 'Select',
    //       placeholder: '请选择合同状态',
    //       options: loadMapInfo?.[`${getTenantID()}${ILoadMapTypeAll.CONTRACT_STATE}`],
    //       disabled: true,
    //       showArrow: false,
    //       initialValue: contractDetailInfo?.state ? contractDetailInfo?.state : `${getTenantID()}${ILoadMapTypeAll.CONTRACT_STATE}1000`,
    //       fieldNames: { label: 'name', value: 'id' },
    //       loading: mapLoading,
    //     },
    //     {
    //       field: `beyondFlag`,
    //       label: `是否超原合同采购金额10%`,
    //       component: 'Render',
    //       slotRender: (text) => {
    //         if (pageType == 'detail') {
    //           return (
    //             <Form.Item name="beyondFlag" style={{ cursor: 'not-allowed' }}>
    //               {renderTableTextNotColor(text)}
    //             </Form.Item>
    //           );
    //         } else {
    //           return (
    //             <TagSelectNew
    //               formLabel=""
    //               formName="beyondFlag"
    //               radioDisabled={true}
    //               radioList={[
    //                 {
    //                   value: 1,
    //                   name: '是',
    //                 },
    //                 {
    //                   value: 0,
    //                   name: '否',
    //                 },
    //               ]}
    //               defalultKeys={text || 0}
    //             />
    //           );
    //         }
    //       },
    //     },
    //     {
    //       field: `contractURL`,
    //       label: `合同文本`,
    //       component: 'Render',
    //       required: pageType == 'detail' ? false : true,
    //       slotRender: (text: any) => {
    //         if (pageType == 'detail') {
    //           const contractName = text ? getFileNameByPath(text) : '';
    //           return (
    //             <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between', padding: 10 }}>
    //               {contractName ? (
    //                 <>
    //                   <a>{contractName}</a>
    //                   <a
    //                     onClick={() => {
    //                       onNtkoReadWord('contractURL', contractDetailInfo, pageType == 'detail' ? true : false);
    //                     }}
    //                   >
    //                     <EyeOutlined />
    //                   </a>
    //                 </>
    //               ) : (
    //                 <span>--</span>
    //               )}
    //             </div>
    //           );
    //         } else {
    //           return (
    //             <UploadFormCommon
    //               form={config.form}
    //               label=""
    //               fileFormName={'contractURL'}
    //               spanCol={24}
    //               inRowProportion={24}
    //               name={'attachFile'}
    //               required={true}
    //               accept={'.docx|.doc'}
    //               url={'/contractController/uploadFile'}
    //               downloadUrl={'/contractController/downloadFile'}
    //               fileFormDelName={'contractURLDel'}
    //               delFunc={() => {}}
    //               maxFile={1}
    //               defaultFiles={contractDetailInfo && contractDetailInfo?.id ? contractDetailInfo?.contractURL : null}
    //               isEdit={true}
    //               fieldBusiPath={'contract/info'}
    //               onNtkoRead={(wordUrl: string) => {
    //                 onNtkoReadWord('contractURL', contractForm?.getFieldsValue(), pageType == 'detail' ? true : false);
    //               }}
    //             >
    //               上传合同文本
    //             </UploadFormCommon>
    //           );
    //         }
    //       },
    //     },
    //     {
    //       field: `changeContent`,
    //       label: `变更内容及原因`,
    //       component: 'InputTextArea',
    //       placeholder: '请输入变更内容及原因',
    //       colSpan: 2,
    //       allowClear: true,
    //       showCount: true,
    //       maxLength: 800,
    //       required: pageType == 'detail' ? false : true,
    //       disabled: pageType == 'detail' ? true : false,
    //       autoSize: { minRows: 5, maxRows: 8 },
    //     },
    //     {
    //       field: 'chanageItem',
    //       label: '变更事项',
    //       component: 'Render',
    //       colSpan: 2,
    //       slotRender: () => {
    //         return (
    //           <Space wrap size={[0, 8]}>
    //             <Form.Item name="changeSum" initialValue={0}>
    //               <Checkbox
    //                 disabled={pageType == 'detail' ? true : false}
    //                 checked={changeModifyItem?.changeSum == '1'}
    //                 onChange={(e: any) => {
    //                   setChangeModifyItem({
    //                     ...changeModifyItem,
    //                     changeSum: e?.target?.checked ? '1' : '0',
    //                   });
    //                   contractForm?.setFieldsValue({
    //                     changeSum: e?.target?.checked ? '1' : '0',
    //                   });
    //                 }}
    //                 style={{ whiteSpace: 'nowrap' }}
    //               >
    //                 合同金额
    //               </Checkbox>
    //             </Form.Item>
    //             <Form.Item name="changeTerm" initialValue={0}>
    //               <Checkbox
    //                 disabled={pageType == 'detail' ? true : false}
    //                 checked={changeModifyItem?.changeTerm == '1'}
    //                 onChange={(e: any) => {
    //                   setChangeModifyItem({
    //                     ...changeModifyItem,
    //                     changeTerm: e?.target?.checked ? '1' : '0',
    //                   });
    //                   contractForm?.setFieldsValue({
    //                     changeTerm: e?.target?.checked ? '1' : '0',
    //                   });
    //                 }}
    //                 style={{ whiteSpace: 'nowrap' }}
    //               >
    //                 履约期限
    //               </Checkbox>
    //             </Form.Item>
    //             <Form.Item name="changeSubject" initialValue={0}>
    //               <Checkbox
    //                 disabled={pageType == 'detail' ? true : false}
    //                 checked={changeModifyItem?.changeSubject == '1'}
    //                 onChange={(e: any) => {
    //                   setChangeModifyItem({
    //                     ...changeModifyItem,
    //                     changeSubject: e?.target?.checked ? '1' : '0',
    //                   });
    //                   contractForm?.setFieldsValue({
    //                     changeSubject: e?.target?.checked ? '1' : '0',
    //                   });
    //                 }}
    //                 style={{ whiteSpace: 'nowrap' }}
    //               >
    //                 合同主体
    //               </Checkbox>
    //             </Form.Item>
    //             <Form.Item name="changeOpposite" initialValue={0}>
    //               <Checkbox
    //                 disabled={pageType == 'detail' ? true : false}
    //                 checked={changeModifyItem?.changeOpposite == '1'}
    //                 onChange={(e: any) => {
    //                   setChangeModifyItem({
    //                     ...changeModifyItem,
    //                     changeOpposite: e?.target?.checked ? '1' : '0',
    //                   });
    //                   contractForm?.setFieldsValue({
    //                     changeOpposite: e?.target?.checked ? '1' : '0',
    //                   });
    //                 }}
    //                 style={{ whiteSpace: 'nowrap' }}
    //               >
    //                 相对方信息
    //               </Checkbox>
    //             </Form.Item>
    //             <Form.Item name="changePay" initialValue={0}>
    //               <Checkbox
    //                 disabled={pageType == 'detail' ? true : false}
    //                 checked={changeModifyItem?.changePay == '1'}
    //                 onChange={(e: any) => {
    //                   setChangeModifyItem({
    //                     ...changeModifyItem,
    //                     changePay: e?.target?.checked ? '1' : '0',
    //                   });
    //                   contractForm?.setFieldsValue({
    //                     changePay: e?.target?.checked ? '1' : '0',
    //                   });
    //                   defaultPayList(e?.target?.checked ? oldContractInfo?.processList : [], contractForm, contractDispatch, contarctJsonList);
    //                 }}
    //                 style={{ whiteSpace: 'nowrap' }}
    //               >
    //                 履约关键节点
    //               </Checkbox>
    //             </Form.Item>
    //             <Form.Item name="changeDetail" initialValue={0}>
    //               <Checkbox
    //                 disabled={pageType == 'detail' ? true : false}
    //                 checked={changeModifyItem?.changeDetail == '1'}
    //                 onChange={(e: any) => {
    //                   setChangeModifyItem({
    //                     ...changeModifyItem,
    //                     changeDetail: e?.target?.checked ? '1' : '0',
    //                   });
    //                   contractForm?.setFieldsValue({
    //                     changeDetail: e?.target?.checked ? '1' : '0',
    //                   });
    //                   defaultDetailList(e?.target?.checked ? oldContractInfo?.detailList : [], contractForm, contractDispatch, contarctJsonList);
    //                 }}
    //                 style={{ whiteSpace: 'nowrap' }}
    //               >
    //                 供货/服务清单
    //               </Checkbox>
    //             </Form.Item>
    //           </Space>
    //         );
    //       },
    //     },
    //     {
    //       field: `oldSumInTax`,
    //       label: `原合同金额`,
    //       component: 'InputNumber',
    //       placeholder: '原合同金额',
    //       ishidden: !(changeModifyItem?.changeSum == 1),
    //       disabled: true,
    //       min: 0,
    //       initialValue: 0.0,
    //       contentAfter: '元',
    //       step: '0.01',
    //     },
    //     {
    //       field: `sumInTax`,
    //       label: `变更合同金额`,
    //       component: 'InputNumber',
    //       placeholder: '变更合同金额',
    //       ishidden: !(changeModifyItem?.changeSum == 1),
    //       required: pageType == 'detail' ? false : true,
    //       disabled: pageType == 'detail' ? true : false,
    //       min: 0,
    //       initialValue: 0.0,
    //       contentAfter: '元',
    //       step: '0.01',
    //     },
    //     {
    //       field: `oldPreBeginTime`,
    //       label: `原预计起始时间`,
    //       component: 'DatePicker',
    //       format: 'YYYY-MM-DD',
    //       placeholder: pageType == 'detail' ? '--' : '请选择',
    //       disabled: true,
    //       ishidden: !(changeModifyItem?.changeTerm == 1),
    //     },
    //     {
    //       field: `oldPreFinishTime`,
    //       label: `原预计结束时间`,
    //       component: 'DatePicker',
    //       format: 'YYYY-MM-DD',
    //       placeholder: pageType == 'detail' ? '--' : '请选择',
    //       disabled: true,
    //       ishidden: !(changeModifyItem?.changeTerm == 1),
    //     },
    //     {
    //       field: `preBeginTime`,
    //       label: `变更预计起始时间`,
    //       component: 'DatePicker',
    //       format: 'YYYY-MM-DD',
    //       placeholder: '请选择',
    //       required: pageType == 'detail' ? false : true,
    //       disabled: pageType == 'detail' ? true : false,
    //       ishidden: !(changeModifyItem?.changeTerm == 1),
    //       onChange: (date: any) => {
    //         setPreBeginTimeStart(date);
    //       },
    //     },
    //     {
    //       field: `preFinishTime`,
    //       label: `变更预计结束时间`,
    //       component: 'DatePicker',
    //       format: 'YYYY-MM-DD',
    //       placeholder: '请选择',
    //       required: pageType == 'detail' ? false : true,
    //       disabled: pageType == 'detail' ? true : false,
    //       ishidden: !(changeModifyItem?.changeTerm == 1),
    //       disabledDate: (date: any) => {
    //         const currentDate: any = preBeginTimeStart ? preBeginTimeStart : date;
    //         return date && date < currentDate;
    //       },
    //     },
    //     {
    //       field: `oldPayStyle`,
    //       label: `原支付方式`,
    //       component: 'Select',
    //       placeholder: '请选择',
    //       disabled: true,
    //       showArrow: false,
    //       options: loadMapInfo?.[payMentCode],
    //       ishidden: !(changeModifyItem?.changePay == 1),
    //       fieldNames: {
    //         label: 'name',
    //         value: 'id',
    //       },
    //     },
    //     {
    //       field: `payStyle`,
    //       label: `变更支付方式`,
    //       component: 'Select',
    //       placeholder: '请选择',
    //       required: pageType == 'detail' ? false : changeModifyItem?.isPayDisabled ? false : true,
    //       disabled: pageType == 'detail' ? true : changeModifyItem?.isPayDisabled ? true : false,
    //       showArrow: pageType == 'detail' ? false : changeModifyItem?.isPayDisabled ? false : true,
    //       options: payMentTypeList,
    //       ishidden: !(changeModifyItem?.changePay == 1),
    //       onChange: (value: string) => {
    //         const contractAllNum: number = contractForm?.getFieldValue('sumInTax') ? contractForm?.getFieldValue('sumInTax') : 0;
    //         if (contractAllNum > 0) {
    //           setPaymentType(value);
    //         } else {
    //           message.warning('请先输入合同金额！');
    //           contractForm?.setFieldsValue({
    //             payStyle: null,
    //           });
    //         }
    //       },
    //       fieldNames: {
    //         label: 'name',
    //         value: 'id',
    //       },
    //     },
    //     {
    //       field: `realBeginTime`,
    //       label: `合同签订时间`,
    //       component: 'DatePicker',
    //       format: 'YYYY-MM-DD',
    //       placeholder: '请选择',
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `realFinishTime`,
    //       label: `合同截止时间`,
    //       component: 'DatePicker',
    //       format: 'YYYY-MM-DD',
    //       placeholder: '请选择',
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `preBeginTime`,
    //       label: `预计起始时间`,
    //       component: 'DatePicker',
    //       format: 'YYYY-MM-DD',
    //       placeholder: '请选择',
    //       ishidden: !(changeModifyItem?.changeTerm != 1),
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `preFinishTime`,
    //       label: `预计结束时间`,
    //       component: 'DatePicker',
    //       format: 'YYYY-MM-DD',
    //       placeholder: '请选择',
    //       ishidden: !(changeModifyItem?.changeTerm != 1),
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `oppositeName`,
    //       label: `合同主体名称`,
    //       component: 'Input',
    //       // required: pageType == 'detail' ? false : true,
    //       disabled: true,
    //       message: '请选择合同主体名称',
    //       placeholder: '请选择',
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `ownDepartmentName`,
    //       label: `申请部门`,
    //       component: 'Input',
    //       disabled: true,
    //       placeholder: '自动带出',
    //       initialValue: getUserDepName(),
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `creditID`,
    //       label: `统一社会信用代码`,
    //       component: 'Input',
    //       disabled: true,
    //       placeholder: '自动带出',
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `bankName`,
    //       label: `开户行名称`,
    //       component: 'Input',
    //       disabled: true,
    //       placeholder: '自动带出',
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `bankAccount`,
    //       label: `开户行账号`,
    //       component: 'Input',
    //       disabled: true,
    //       placeholder: '自动带出',
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `workAddress`,
    //       label: `单位地址`,
    //       component: 'Input',
    //       disabled: true,
    //       placeholder: '自动带出',
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `registerPhone`,
    //       label: `单位电话`,
    //       component: 'Input',
    //       disabled: true,
    //       placeholder: '自动带出',
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `ownerName`,
    //       label: `联系人`,
    //       component: 'Input',
    //       placeholder: '请选择联系人',
    //       disabled: true,
    //       initialValue: getUserName(),
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `ownPhone`,
    //       label: `联系电话`,
    //       component: 'Input',
    //       required: pageType == 'detail' ? false : true,
    //       disabled: pageType == 'detail' ? true : false,
    //       placeholder: '请输入',
    //       pattern: RegularExpression.phone,
    //       patternMsg: '联系电话格式不正确',
    //       initialValue: getPersonalInfo()?.phoneMobile,
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `oppositeID`,
    //       label: `合同主体ID`,
    //       component: 'Input',
    //       message: '请选择合同主体ID',
    //       placeholder: '请选择',
    //       disabled: true,
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `contactName`,
    //       label: `联系人`,
    //       component: 'Input',
    //       message: '请选择联系人',
    //       placeholder: '请选择',
    //       disabled: true,
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `phoneMobile`,
    //       label: `联系人电话`,
    //       component: 'Input',
    //       message: '请选择联系人电话',
    //       placeholder: '请选择',
    //       disabled: true,
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `ownerID`,
    //       label: `联系人ID`,
    //       component: 'Input',
    //       message: '请选择联系人ID',
    //       placeholder: '请选择',
    //       disabled: true,
    //       initialValue: getUserID(),
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `ownCompanyID`,
    //       label: `联系人公司ID`,
    //       component: 'Input',
    //       message: '请选择联系人公司ID',
    //       placeholder: '请选择',
    //       disabled: true,
    //       initialValue: getCompanyID(),
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //     {
    //       field: `ownDepartmentID`,
    //       label: `联系人部门ID`,
    //       component: 'Input',
    //       message: '请选择联系人部门ID',
    //       placeholder: '请选择',
    //       disabled: true,
    //       colSpan: 2,
    //       initialValue: getUserDepID(),
    //       display: 'none',
    //     },
    //     {
    //       field: `ownPositionID`,
    //       label: `联系人岗位ID`,
    //       component: 'Input',
    //       message: '请选择联系人岗位ID',
    //       placeholder: '请选择',
    //       disabled: true,
    //       initialValue: getPosIDs(),
    //       colSpan: 2,
    //       display: 'none',
    //     },
    //   ],
    // },
    {
      key: 'contract-modify-partyA',
      title: '合同主体信息',
      ishidden: !(changeModifyItem?.changeSubject == 1),
      fieldCustomDom: (
        <UpdateFirstPartyTableView
          openSubjectModal={() => {
            setOpenSujbectModal(true);
          }}
        />
      ),
    },
    {
      key: 'contract-counterpart-modify',
      title: '相对方信息',
      ishidden: !(changeModifyItem?.changeOpposite == 1),
      fieldCustomDom: <UpdateCounterpartView openCounterpartModal={openCounterpartModal} />,
    },
    {
      key: 'contract-payment-modify',
      title: '履约关键节点',
      ishidden: !(changeModifyItem?.changePay == 1),
      fieldCustomDom: <UpdatePaymentView formName={contractForm} selectPaymentType={paymentType} />,
    },
    {
      key: 'contract-modify-supplyService',
      title: '货物/服务清单',
      ishidden: !(changeModifyItem?.changeDetail == 1),
      fieldCustomDom: <UpdateMaterialTableView setOpenMaterialModal={setOpenMaterialModal} loadMapInfo={loadMapInfo} formName={contractForm} />,
    },
  ];

  /** 表单配置 */
  const [config, methods] = useDescriptionsType({
    labelWidth: 190,
    basicForm: contractForm,
    name: 'contract-modify-form',
    schemas: configShemas,
  });

  return {
    config,
    methods,
  };
};

interface IGetBreakUpdateDes {
  openOldContractInfo: () => void;
  onNtkoReadWord: (url: string, urlObj: Record<string, any>, onlyRead?: boolean) => void;
  onOpenReadOfdWord: (url: string) => void;
  isSeeOldContract?: boolean | any;
}

/** 解除合同表单 */
const getBreakUpdateDes = ({ openOldContractInfo, onNtkoReadWord, onOpenReadOfdWord, isSeeOldContract }: IGetBreakUpdateDes) => {
  const { pageType, contractForm, contractDetailInfo } = useContext(ConractControllerContext);
  /**  获取数据字典 */
  const { loadMapInfo, mapLoading } = getLoadMapList([
    `${getTenantID()}${ILoadMapTypeAll.PAYMENT_STYLE}`, //支付方式
    `${getTenantID()}${ILoadMapTypeAll.COMPANY_TAXRATE}`, //税率
    `${getTenantID()}${ILoadMapTypeAll.CONTRACT_FIELDTYPE}`, //合同附件类型
    `${getTenantID()}${ILoadMapTypeAll.MATERIAL_MIDI}`, //量化单位
    `${getTenantID()}${ILoadMapTypeAll.CONTRACT_TYPE}`, // 合同类型
    `${getTenantID()}${ILoadMapTypeAll.CONTRACT_STATE}`, // 合同状态
    `${getTenantID()}${ILoadMapTypeAll.CONTRACT_CURRENCYTYPE}`, //币种
  ]);

  let configShemas: any = [
    {
      key: 'contract-old-modify-break',
      title: '解除信息',
      fieldChildren: [
        {
          field: `contractName`,
          label: `解除合同名称`,
          component: 'Input',
          placeholder: '请输入变更合同名称',
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
        },
        {
          field: `contractCode`,
          label: `解除合同编号`,
          component: 'Input',
          placeholder: '自动带出',
          disabled: true,
        },
        {
          field: `oldContractName`,
          label: `原合同名称`,
          component: 'Input',
          placeholder: '请输入原合同名称',
          disabled: true,
          contentAfter: isSeeOldContract ? (
            <a onClick={openOldContractInfo}>
              <EyeOutlined />
            </a>
          ) : pageType == 'detail' ? null : (
            <a onClick={openOldContractInfo}>
              <EyeOutlined />
            </a>
          ),
        },
        {
          field: `oldContractCode`,
          label: `原合同编号`,
          component: 'Input',
          disabled: true,
          placeholder: '自动生成',
        },
        // {
        //   field: `oldProjectName`,
        //   label: `原资金来源`,
        //   component: 'Input',
        //   disabled: true,
        //   placeholder: '自动生成',
        // },
        // {
        //   field: `oldProjectCode`,
        //   label: `原来源项目编号`,
        //   component: 'Input',
        //   disabled: true,
        //   placeholder: '自动生成',
        // },
        // {
        //   field: `oldContractInfo`,
        //   label: `原合同简介`,
        //   component: 'InputTextArea',
        //   placeholder: '请输入原合同简介',
        //   disabled: true,
        //   colSpan: 2,
        //   allowClear: true,
        //   showCount: true,
        //   maxLength: 500,
        //   required: false,
        //   autoSize: { minRows: 4, maxRows: 8 },
        // },
        // {
        //   field: `realBeginTime`,
        //   label: `合同签订时间`,
        //   component: 'DatePicker',
        //   format: 'YYYY-MM-DD',
        //   placeholder: '请选择',
        //   colSpan: 2,
        //   display: 'none',
        // },
        // {
        //   field: `realFinishTime`,
        //   label: `合同截止时间`,
        //   component: 'DatePicker',
        //   format: 'YYYY-MM-DD',
        //   placeholder: '请选择',
        //   colSpan: 2,
        //   display: 'none',
        // },
        // {
        //   field: `preBeginTime`,
        //   label: `预计起始时间`,
        //   component: 'DatePicker',
        //   format: 'YYYY-MM-DD',
        //   placeholder: '请选择',
        //   colSpan: 2,
        //   display: 'none',
        // },
        // {
        //   field: `preFinishTime`,
        //   label: `预计结束时间`,
        //   component: 'DatePicker',
        //   format: 'YYYY-MM-DD',
        //   placeholder: '请选择',
        //   colSpan: 2,
        //   display: 'none',
        // },
        // {
        //   field: `workflowType`,
        //   label: `合同流程`,
        //   component: 'Input',
        //   message: '合同流程',
        //   placeholder: '合同流程',
        //   initialValue: `${getTenantID()}${ILoadMapTypeAll.CONTRACT_FLOWTYPE}1000`,
        //   disabled: true,
        //   colSpan: 2,
        //   display: 'none',
        // },
        {
          field: `contractURL`,
          label: `解除协议`,
          component: 'Render',
          required: pageType == 'detail' ? false : true,
          colSpan: 2,
          slotRender: (text: any) => {
            if (pageType == 'detail') {
              const contractName = text ? getFileNameByPath(text) : '';
              return (
                <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between', padding: 10 }}>
                  {contractName ? (
                    <>
                      <a>{contractName}</a>
                      <a
                        onClick={() => {
                          // onNtkoReadWord('contractURL', contractDetailInfo, pageType == 'detail' ? true : false);
                          onOpenReadOfdWord(contractDetailInfo?.contractURL);
                        }}
                      >
                        <EyeOutlined />
                      </a>
                    </>
                  ) : (
                    <span>--</span>
                  )}
                </div>
              );
            } else {
              return (
                <UploadFormCommon
                  form={config.form}
                  label=""
                  fileFormName={'contractURL'}
                  spanCol={24}
                  inRowProportion={24}
                  name={'attachFile'}
                  required={true}
                  accept={'.docx|.doc'}
                  url={'/contractController/uploadFile'}
                  downloadUrl={'/contractController/downloadFile'}
                  fileFormDelName={'contractURLDel'}
                  delFunc={() => {}}
                  maxFile={1}
                  defaultFiles={contractDetailInfo && contractDetailInfo?.id ? contractDetailInfo?.contractURL : null}
                  isEdit={true}
                  fieldBusiPath={'contract/info'}
                  onNtkoRead={(wordUrl: string) => {
                    // onNtkoReadWord('contractURL', contractForm?.getFieldsValue(), pageType == 'detail' ? true : false);
                    onOpenReadOfdWord(contractForm?.getFieldValue('contractURL'));
                  }}
                >
                  上传合同文本
                </UploadFormCommon>
              );
            }
          },
        },
        {
          field: `changeContent`,
          label: `解除合同原因`,
          component: 'InputTextArea',
          placeholder: '请输入解除合同原因',
          colSpan: 2,
          allowClear: true,
          showCount: true,
          maxLength: 800,
          required: pageType == 'detail' ? false : true,
          disabled: pageType == 'detail' ? true : false,
          autoSize: { minRows: 5, maxRows: 8 },
        },
      ],
    },
    // {
    //   key: 'contract-break-basicInfo',
    //   title: '解除信息',
    //   fieldChildren: [
    //     {
    //       field: `contractName`,
    //       label: `解除合同名称`,
    //       component: 'Input',
    //       placeholder: '请输入变更合同名称',
    //       required: pageType == 'detail' ? false : true,
    //       disabled: pageType == 'detail' ? true : false,
    //     },
    //     {
    //       field: `contractCode`,
    //       label: `解除合同编号`,
    //       component: 'Input',
    //       placeholder: '请输入变更合同编号',
    //       disabled: true,
    //     },
    //     {
    //       field: `state`,
    //       label: `合同状态`,
    //       component: 'Select',
    //       placeholder: '请选择合同状态',
    //       options: loadMapInfo?.[`${getTenantID()}${ILoadMapTypeAll.CONTRACT_STATE}`],
    //       disabled: true,
    //       showArrow: false,
    //       initialValue: contractDetailInfo?.state ? contractDetailInfo?.state : `${getTenantID()}${ILoadMapTypeAll.CONTRACT_STATE}1000`,
    //       fieldNames: { label: 'name', value: 'id' },
    //       loading: mapLoading,
    //     },
    //     {
    //       field: `contractURL`,
    //       label: `合同文本`,
    //       component: 'Render',
    //       required: pageType == 'detail' ? false : true,
    //       slotRender: (text: any) => {
    //         if (pageType == 'detail') {
    //           const contractName = text ? getFileNameByPath(text) : '';
    //           return (
    //             <div style={{ width: '100%', display: 'flex', justifyContent: 'space-between', padding: 10 }}>
    //               {contractName ? (
    //                 <>
    //                   <a>{contractName}</a>
    //                   <a
    //                     onClick={() => {
    //                       onNtkoReadWord('contractURL', contractDetailInfo, pageType == 'detail' ? true : false);
    //                     }}
    //                   >
    //                     <EyeOutlined />
    //                   </a>
    //                 </>
    //               ) : (
    //                 <span>--</span>
    //               )}
    //             </div>
    //           );
    //         } else {
    //           return (
    //             <UploadFormCommon
    //               form={config.form}
    //               label=""
    //               fileFormName={'contractURL'}
    //               spanCol={24}
    //               inRowProportion={24}
    //               name={'attachFile'}
    //               required={true}
    //               accept={'.docx|.doc'}
    //               url={'/contractController/uploadFile'}
    //               downloadUrl={'/contractController/downloadFile'}
    //               fileFormDelName={'contractURLDel'}
    //               delFunc={() => {}}
    //               maxFile={1}
    //               defaultFiles={contractDetailInfo && contractDetailInfo?.id ? contractDetailInfo?.contractURL : null}
    //               isEdit={true}
    //               fieldBusiPath={'contract/info'}
    //               onNtkoRead={(wordUrl: string) => {
    //                 onNtkoReadWord('contractURL', contractForm?.getFieldsValue(), pageType == 'detail' ? true : false);
    //               }}
    //             >
    //               上传合同文本
    //             </UploadFormCommon>
    //           );
    //         }
    //       },
    //     },
    //     {
    //       field: `changeContent`,
    //       label: `解除合同原因`,
    //       component: 'InputTextArea',
    //       placeholder: '请输入解除合同原因',
    //       colSpan: 2,
    //       allowClear: true,
    //       showCount: true,
    //       maxLength: 800,
    //       required: pageType == 'detail' ? false : true,
    //       disabled: pageType == 'detail' ? true : false,
    //       autoSize: { minRows: 5, maxRows: 8 },
    //     },
    //   ],
    // },
  ];

  /** 表单配置 */
  const [config, methods] = useDescriptionsType({
    labelWidth: 190,
    basicForm: contractForm,
    name: 'contract-modify-form',
    schemas: configShemas,
  });

  return {
    config,
    methods,
  };
};
export { getModifyUpdateDes, getBreakUpdateDes };
